import { useEffect } from 'react';
import useRealtimeRef from '../useRealtimeRef';
/**
 * 组件卸载时执行 fn
 * @param fn
 */
var useUnmount = function useUnmount(fn) {
  var fnRef = useRealtimeRef(fn);
  useEffect(function () {
    return function () {
      var _fnRef$current;
      return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call(fnRef);
    };
  }, []);
};
export default useUnmount;